<template>
  <div>
    <a-layout id="components-layout-demo-side" style="min-height: 100vh">
      <a-layout-sider v-model="collapsed" collapsible>
        <div class="logo" />
        <a-menu theme="dark" :default-selected-keys="['2']" mode="inline">
          <a-menu-item key="1">
            <a-icon type="appstore" />
            <span>首页</span>
          </a-menu-item>
          <a-sub-menu key="sub1">
            <span slot="title">
              <a-icon type="file" />
              <span>数据管理</span>
            </span>

            <a-menu-item @click="goUser" key="2">用户列表</a-menu-item>
            <a-menu-item @click="goShoplist" key="3">商家列表</a-menu-item>
            <a-menu-item key="4">食品列表</a-menu-item>
            <a-menu-item key="5">订单列表</a-menu-item>
            <a-menu-item key="6">管理员列表</a-menu-item>
          </a-sub-menu>
          <a-sub-menu key="sub2">
            <span slot="title">
              <a-icon type="plus" />
              <span>添加数据</span>
            </span>
          </a-sub-menu>
          <a-sub-menu key="sub3">
            <span slot="title">
              <a-icon type="star" />
              <span>图表</span>
            </span>
          </a-sub-menu>
          <a-sub-menu key="sub4">
            <span slot="title">
              <a-icon type="edit" />
              <span>编辑</span>
            </span>
          </a-sub-menu>
          <a-sub-menu key="sub5">
            <span slot="title">
              <a-icon type="setting" />
              <span>设置</span>
            </span>
          </a-sub-menu>
          <a-sub-menu key="sub6">
            <span slot="title">
              <a-icon type="info-circle" />
              <span>说明</span>
            </span>
          </a-sub-menu>
        </a-menu>
      </a-layout-sider>
      <a-layout>
        <a-layout-header style="background: #d6e2f1; padding: 0;text-indent:30px;">
          <span>首页&nbsp;&nbsp; /&nbsp;&nbsp; 数据管理&nbsp;&nbsp; /&nbsp;&nbsp; 
            <span v-show="isUser" style="color:#999;">用户列表</span>
            <span v-show="isShop" style="color:#999;">商家列表</span>
          </span>
        </a-layout-header>
        <a-layout-content style="margin: 0 16px">
          <a-breadcrumb style="margin: 16px 0"></a-breadcrumb>
          <router-view/>
        </a-layout-content>
      </a-layout>
    </a-layout>
  </div>
</template>

<script>
export default {
   data() {
    return {
      collapsed: false,
      isUser:true,
      isShop:false
    };
  },
  methods:{
    goUser() {
      this.$router.push('/userList');
      this.isUser = true;
      this.isShop = false;
    },
    goShoplist() {
      this.$router.push('/shopList');
       this.isUser = false;
      this.isShop = true;
    }
  },
  mounted(){
    this.$store.dispatch('getData')
  }
};
</script>

<style scoped>

</style>